Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new dsn for destroy group #535

Merged

Conversation

JacksonYao287
Copy link
Contributor

@JacksonYao287 JacksonYao287 commented Aug 30, 2024

if we have a rreq {originator=1, term=1, dsn=0, lsn=7} in follower and a baseline resync is triggerd before the rreq is committed in the follower, then the on_commit of the rreq will not be called and as a result this rreq will become a garbage rreq in this follower. now if we trigger a destroy_group, a new rreq {originator=1, term=1, dsn=0} will created in the follower since the default dsn of a repl_key is 0.after the log of this rreq is appended to log store and get a new lsn, if we link the new lsn to the old rreq which has alread have a lsn, then a assert will be throw out. pls refer to repl_req_ctx::set_lsn

in this pr, we set the dsn to a new one , which is definitely unique in the follower, so that the new rreq will not have a conflict with the old rreq.

@JacksonYao287 JacksonYao287 linked an issue Aug 30, 2024 that may be closed by this pull request
@JacksonYao287 JacksonYao287 force-pushed the add-lsn-check-before-append-entry branch from 69f4621 to e869041 Compare August 30, 2024 09:53
@JacksonYao287 JacksonYao287 marked this pull request as draft August 30, 2024 10:10
@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 68.23%. Comparing base (1a0cef8) to head (548121b).
Report is 71 commits behind head on master.

Files with missing lines Patch % Lines
src/lib/replication/repl_dev/raft_repl_dev.cpp 50.00% 1 Missing and 1 partial ⚠️
...rc/lib/replication/repl_dev/raft_state_machine.cpp 50.00% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #535       +/-   ##
===========================================
+ Coverage   56.51%   68.23%   +11.72%     
===========================================
  Files         108      109        +1     
  Lines       10300    10431      +131     
  Branches     1402     1398        -4     
===========================================
+ Hits         5821     7118     +1297     
+ Misses       3894     2639     -1255     
- Partials      585      674       +89     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JacksonYao287 JacksonYao287 force-pushed the add-lsn-check-before-append-entry branch from e869041 to 3e3fbfd Compare September 1, 2024 10:47
@JacksonYao287 JacksonYao287 self-assigned this Sep 1, 2024
@JacksonYao287 JacksonYao287 marked this pull request as ready for review September 1, 2024 10:48
@JacksonYao287 JacksonYao287 changed the title add lsn check before append entry add new dsn for destroy group Sep 1, 2024
@JacksonYao287 JacksonYao287 force-pushed the add-lsn-check-before-append-entry branch from fef6bb0 to 952b530 Compare September 1, 2024 11:04
if (remain_cnt-- > 0) {
size_t avail_size = out_buf->size() - out_buf->pos();
if (avail_size < entry.size() + sizeof(uint32_t)) {
avail_size += std::max(out_buf->size() * 2, (size_t)entry.size() + sizeof(uint32_t));
// available size of packing buffer should be able to hold entry.size() and the length of this entry
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yamingk I address your comments for the last PR here, PATL

Copy link
Collaborator

@xiaoxichen xiaoxichen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@JacksonYao287 JacksonYao287 merged commit 0fa6a0c into eBay:master Sep 2, 2024
21 checks passed
@JacksonYao287 JacksonYao287 deleted the add-lsn-check-before-append-entry branch September 2, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add check for receiving duplicated log entry
3 participants